import pytest
import time
import os

if __name__ == '__main__':
    report_dir = r'..\reports'     # 指定目录
    now = time.strftime('%Y-%m-%d_%H_%M_%S')  # 生成的时间
    report_name = rf'{report_dir}\{now}_html' # rf格式化路径上的字符串

    args = [r'..\test_case', '-vs', rf'--alluredir={report_dir}','--clean-alluredir']
    cmd = rf'allure generate {report_dir} -o {report_name}'

    pytest.main(args)
    os.system(cmd)

